#! /bin/sh
# $Id: test-prop-config 196 2006-03-25 13:35:20Z sfsetse $
#
# Author: Kate Ward <kate.ward@forestent.com>
#

# find myself
whoAmI=`basename $0`
whereAmI=`dirname $0`
whereAmI=`cd "${whereAmI}" 2>/dev/null && pwd || echo "${whereAmI}"`

#-----------------------------------------------------------------------------
# functions
#

test_cleanup()
{
  echo '### test script cleanup function called###'
}

loadLog4sh()
{
  config="$1"

  if [ -r log4sh ]; then
    LOG4SH_CONFIGURATION="${config}" . ./log4sh
  else
    echo "ERROR: could not load (log4sh)" >&2
    exit 1
  fi
  logger_trace "whoAmI=${whoAmI} whereAmI=${whereAmI}"
}

#-----------------------------------------------------------------------------
# pre-configure log4sh
#
# the functions called in this section are meant to exactly reproduce what the
# runtime configuration test script does so that the common tests that are run
# generate the same output.

configLog4sh()
{
  :
}

#-----------------------------------------------------------------------------
# main
#

# setup trap handler.  must be done before loading log4sh
trap 'test_cleanup' EXIT

# load and configure log4sh
loadLog4sh
configLog4sh

# load and run the common tests
commonTests='test-common'
if [ -r "${commonTests}" ]; then
  . ${whereAmI}/${commonTests}
else
  logger_fatal "could not load the common tests"
  exit 1
fi
